import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_navigation/get_navigation.dart';
import 'package:star_author/config/base_configuration.dart';
import 'package:star_author/widgets/empty_view/v_empty_view.dart';

///是否切换当前讲解主播为
class SelectAnchorDialog extends StatefulWidget {
  final Function? sure;
  final String anchorName;

  SelectAnchorDialog(
    this.anchorName,
    this.sure, {
    Key? key,
  }) : super(key: key);

  @override
  _SelectAnchorDialogState createState() => _SelectAnchorDialogState();
}

class _SelectAnchorDialogState extends State<SelectAnchorDialog> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(
        top: 20.w,
      ),
      child: Column(
        children: [
          Container(
            alignment: Alignment.center,
            padding: EdgeInsets.only(
              left: 12.w,
              right: 12.w,
            ),
            child: Text(
              "是否切换当前讲解主播为",
              style: TextStyle(
                fontSize: 16.sp,
                color: ColorConf.normal,
              ),
              textAlign: TextAlign.center,
            ),
          ),
          VEmptyView(6.w),
          Text(
            "${widget.anchorName}",
            style: TextStyle(
              fontSize: 20.sp,
              fontWeight: FontWeight.w500,
              color: Color(0xffFF8F00),
            ),
            textAlign: TextAlign.center,
          ),
          SizedBox(
            height: 18.w,
          ),
          Container(
            height: 43.w,
            decoration: BoxDecoration(
              border: Border(
                top: BorderSide(
                  color: Color(0xFFEEEEEE),
                  width: 1.w,
                ),
              ),
            ),
            child: Row(
              children: [
                Expanded(
                  child: InkWell(
                    onTap: () {
                      Get.back();
                    },
                    child: Text(
                      "取消",
                      style:
                          TextStyle(fontSize: 16.sp, color: Color(0xFF666666)),
                      textAlign: TextAlign.center,
                    ),
                  ),
                ),
                Container(
                  height: 43.w,
                  width: 1.w,
                  color: Color(0xFFEEEEEE),
                ),
                Expanded(
                  child: InkWell(
                    onTap: () {
                      Get.back();
                      widget.sure!();
                    },
                    child: Text(
                      "确认切换",
                      style: TextStyle(
                          fontSize: 16.sp,
                          color: Color(0xFFE02020),
                          fontWeight: FontWeight.w500),
                      textAlign: TextAlign.center,
                    ),
                  ),
                ),
              ],
            ),
          )
        ],
      ),
    );
  }
}
